Write a custom CUDA kernel to optimize `APALU` (Adaptive Piecewise Approximated activation Linear Unit).

Formula:
  f(x) = a * (x + x / (1 + exp(-1.702*x)))    if x >= 0
  f(x) = b * (exp(x) - 1)                      if x < 0
where `a` and `b` are trainable `nn.Parameter`s.

Problem Analysis:
1. Memory Bound: This is an element-wise activation with multiple branches and `exp`.
2. Operator Chaining: The PyTorch implementation uses `torch.where` and creates multiple intermediate tensors.
3. Trainable Parameters: The kernel must accept `a` and `b` as scalar inputs determined at runtime.

Optimization Strategy: Fused Element-wise Kernel with Vectorization

1. One-Thread-per-Element: Map each element to a CUDA thread.

2. Vectorized Loads (float4): Use `float4` to process 128 bits per memory transaction.

3. Fused In-Register Math:
   - Pass scalar parameters `a` and `b` to the kernel.
   - Use a nested `if-else` to handle the three segments.
   - All computations are fused in registers.

4. One-Pass: Fuse all steps into a single read-compute-write kernel.
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn

# --- 基准测试配置 ---
BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

# APALU 初始参数
A_INIT = 0.55
B_INIT = 0.065

class APALU(nn.Module):
    '''
    APALU: ATrainable, Adaptive Activation Function for Deep Learning Networks
    https://arxiv.org/pdf/2402.08244
    Formula:
      f(x) = a * (x + x / (1 + exp(-1.702*x)))    if x >= 0
      f(x) = b * (exp(x) - 1)                      if x < 0
    '''
    def __init__(self, a_init=0.55, b_init=0.065):
        super(APALU, self).__init__()
        self.a = nn.Parameter(torch.tensor(a_init))
        self.b = nn.Parameter(torch.tensor(b_init))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        pos_part = self.a * (x + x / (1.0 + torch.exp(-1.702 * x)))
        neg_part = self.b * (torch.exp(x) - 1.0)
        return torch.where(x >= 0, pos_part, neg_part)

class Model(nn.Module):
    def __init__(self, a_init=0.55, b_init=0.065):
        super(Model, self).__init__()
        self.act = APALU(a_init, b_init)
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=torch.float32) * 5.0
    return [input_tensor.contiguous()]

def get_init_inputs():
    return [A_INIT, B_INIT]